#include "StdAfx.h"
#include <cassert>
#include "ShapeObject.h"

CShapeObject::CShapeObject(void)
{
	m_isSelectedAs = SLT_NONE;
	m_pParentShape = NULL;
	m_isScaling =false;
}

CShapeObject::~CShapeObject(void)
{
}

void CShapeObject::attach( CShapeObject* p_pShape )
{
	assert(p_pShape);
	p_pShape->getChildList().push_back(this);
	m_pParentShape = p_pShape;
}

void CShapeObject::detach()
{
	assert(m_pParentShape);
	m_pParentShape->getChildList().remove(this);
	m_pParentShape = NULL;
}

bool CShapeObject::isKindOf( Shape_Type p_type )
{
	if( ( m_type == ST_RECTANGLE ||
		  m_type == ST_DIAMOND	 || 
		  m_type == ST_TEXT )
		&&
		( p_type == ST_NODE ||
		  p_type == ST_SHAPEOBJECT ) )
	{
		return true;
	}
	else if( m_type == ST_ARROW &&
			 p_type == ST_LINE )
		 return true;

	return false;
}
